package com.icow.util;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

@Converter
public class JSONObjectConverter implements AttributeConverter<JSONObject, String> {

	@Override
	public String convertToDatabaseColumn(JSONObject attribute) {
		return attribute.toJSONString();
	}

	@Override
	public JSONObject convertToEntityAttribute(String dbData) {
		return JSON.parseObject(dbData);

	}

}
